<?php


namespace app\unify\validate;


use think\Validate;
use app\unify\model\Api as ApiModel;

class Api extends Validate
{

    const UPDATE = 'Update';
    const SAVE = "Save";
    const DELETE = "Delete";
    const UPDATE_FIELD = "UpdateField";


    protected $rule = [
        'platform|平台' => 'require|array',
        'id|编号' => 'require|integer',
        'path|地址' => 'require|length:1,50',
        'desc|描述' => 'length:1,255',
        'authList|权限' => 'array',
        'anonymous|匿名访问' => 'require|integer',
        'allow|允许访问' => 'require|integer',
        'ids|编号集合' => 'require|array',
        'value|字段值' => 'require',
        'field|字段名' => 'require|in:anonymous,allow'
    ];

    protected $scene = [
        self::SAVE => ['allow', 'anonymous', 'path', 'description', 'authList', 'platform'],
        self::UPDATE => ['id', 'allow', 'anonymous', 'path', 'description', 'authList', 'platform'],
        self::UPDATE_FIELD => ['ids', 'field', 'value'],
        self::DELETE => ['ids'],
    ];

}